package cn.pconline.autoclub.entity;

import java.util.Date;
import org.gelivable.dao.Column;
import org.gelivable.dao.Entity;
import org.gelivable.dao.Id;
import org.gelivable.dao.Transient;

@Entity(tableName = "ac_member_all")
public class MemberAll implements EntityWithUserProp {

    @Id
    @Column(name = "club_id")
    private long clubId;  		//车友会id
    @Id
    @Column(name = "user_id")
    private long userId;		//成员id
    @Column(name = "check_count")
    private int checkCount;  	//总签到天数
    @Column(name = "topic_count")
    private int topicCount;		//总主题数
    @Column(name = "pick_count")
    private int pickCount;		//总精华数
    @Column(name = "recommend_count")
    private int recommendCount;	//总推荐数'
    private int petrol;			//总油值
    @Column(name = "create_at")
    private Date createAt;
    @Column(name = "update_at")
    private Date updateAt;
    @Transient
    private ClubMember clubMember;
    @Transient(cache = false)
    private User user;

    public long getClubId() {
        return clubId;
    }

    public void setClubId(long clubId) {
        this.clubId = clubId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public int getCheckCount() {
        return checkCount;
    }

    public void setCheckCount(int checkCount) {
        this.checkCount = checkCount;
    }

    public int getTopicCount() {
        return topicCount;
    }

    public void setTopicCount(int topicCount) {
        this.topicCount = topicCount;
    }

    public int getPickCount() {
        return pickCount;
    }

    public void setPickCount(int pickCount) {
        this.pickCount = pickCount;
    }

    public int getRecommendCount() {
        return recommendCount;
    }

    public void setRecommendCount(int recommendCount) {
        this.recommendCount = recommendCount;
    }

    public int getPetrol() {
        return petrol;
    }

    public void setPetrol(int petrol) {
        this.petrol = petrol;
    }

    public Date getCreateAt() {
        return createAt;
    }

    public void setCreateAt(Date createAt) {
        this.createAt = createAt;
    }

    public Date getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Date updateAt) {
        this.updateAt = updateAt;
    }

    public ClubMember getClubMember() {
        return clubMember;
    }

    public void setClubMember(ClubMember clubMember) {
        this.clubMember = clubMember;
    }

    @Override
    public long getUid() {
        return userId;
    }

    @Override
    public User getUser() {
        return user;
    }

    @Override
    public void setUid(long uid) {
        this.userId = uid;

    }

    @Override
    public void setUser(User user) {
        this.user = user;
    }

    public static MemberAll getInstance(long clubId, long userId, Date now) {
        MemberAll memberAll = new MemberAll();
        memberAll.setCheckCount(0);
        memberAll.setTopicCount(0);
        memberAll.setPickCount(0);
        memberAll.setRecommendCount(0);
        memberAll.setPetrol(0);
        memberAll.setClubId(clubId);
        memberAll.setUserId(userId);
        memberAll.setCreateAt(now);
        memberAll.setUpdateAt(now);
        return memberAll;
    }
}
